<?php
$this->Html->addCrumb('Employee List','/Employees');
$this->Html->addCrumb(h($employee['Employee']['e_fname']).' '.h($employee['Employee']['e_lname']));
?>

<div class="colLeft">
<?php
//div class used to be employeeView
?>
<h2><?php  echo __('Employee'); ?></h2>
	<table>
		<tr>
		<th><?php echo __('Employee Name'); ?></th>
		</tr>
		<tr>
		<td>
			<?php echo h($employee['Employee']['e_fname']).', '.h($employee['Employee']['e_lname']); ?>
			&nbsp;
		</td>
		</tr>
		<tr>
		<th><?php echo __('Home Phone'); ?></th>
		</tr>
		<tr>
		<td>
			<?php echo h($employee['Employee']['e_homephone']); ?>
			&nbsp;
		</td>
		</tr>
		<tr>
		<th><?php echo __('Mobile'); ?></th>
		</tr>
		<tr>
		<td>
			<?php echo h($employee['Employee']['e_mobilephone']); ?>
			&nbsp;
		</td>
		</tr>
		<tr>
		<th><?php echo __('Email'); ?></th>
		</tr>
		<tr>
		<td>
			<a href="<?php echo 'mailto:'.h($employee['Employee']['e_email']); ?>"/><?php echo h($employee['Employee']['e_email']);?></a>
			&nbsp;
		</td>
		</tr>
		<tr>
		<th><?php echo __('Taxfile'); ?></th>
		</tr>
		<tr>
		<td>
			<?php echo h($employee['Employee']['e_taxfile']); ?>
			&nbsp;
		</td>
		</tr>
		<tr>
		<th><?php echo __('Date of Birth'); ?></th>
		</tr>
		<tr>
		<td>
			<?php echo date('d-m-Y', strtotime(h($employee['Employee']['e_dob']))); ?>
			&nbsp;
		</td>
		</tr>
		<tr>
		<th><?php echo __('Next of Kin'); ?></th>
		</tr>
		<tr>
		<td>
			<?php echo h($employee['Employee']['e_nextOK']); ?>
			&nbsp;
		</td>
		</tr>

		<tr>
		<th><?php echo __('Employee CV'); ?></th>
		</tr>
		<tr>
		<td>
			
			<?php 
			echo $this->Html->link(__(h('Link to CV')), '/'.h($employee['Employee']['e_cv']));
			?>
			&nbsp;
		</td>
		</tr>
		<tr>
		<th><?php echo __('Start Date'); ?></th>
		</tr>
		<tr>
		<td>
			<?php echo date('d-m-Y', strtotime(h($employee['Employee']['e_dateStart']))); ?>
			&nbsp;
		</td>
		</tr>
		<tr>
		<th><?php echo __('End Date'); ?></th>
		</tr>
		<tr>
		<td>
			<?php echo date('d-m-Y', strtotime(h($employee['Employee']['e_dateEnd']))); ?>
			&nbsp;
		</td>
		</tr>
	</table>
</div>

<?php 
if($employee['Employee']['e_cv'] != '')
{
?>
<div class="colRight">
<table>
		<tr>
			<td>
				<object width="600px" height="500px" type="<?php echo h($employee['Employee']['cv_type']);?>" data="<?php echo $this->Html->url('/', true);?><?php echo h($employee['Employee']['e_cv'])?>" id="pdf_content">
					<param name="view" value="FitW" />
					<param name="toolbar" value="0" />
					<param name="statusbar" value="0" />
					<iframe style="width:680px; height:500px;" src="http://docs.google.com/gview?url=<?php echo $this->Html->url('/', true);?><?php echo h($employee['Employee']['e_cv'])?>&embedded=true" style="width:718px; height:700px;" frameborder="0"></iframe>
					<p>A problem occured when loading the viewer, Click the link below to Download File.</p>
				</object>
				<?php echo $this->Html->link("Problem Loading Viewer? Click here to Download File", '/'.h($employee['Employee']['e_cv'])); ?>
			</td>
		</tr>
	</table>
</div>
<?php 
}
?>
<div class="employeeHistory">
<h2><?php  echo __('History'); ?></h2>
<table>
	<tr>
		<th>Job Level</th>
		<th>Job Type</th>
		<th>Job Status</th>
	</tr>
	<tr>
		<td>
		<?php
			//Loop to Display Dates of Job Level (Historical)
			$records = 1;
			$loops = count($employee['EmployeeJobLvl']);
			foreach ($employee['EmployeeJobLvl'] as $emp_joblvl): ?>
			<?php
			if($records >= $loops)
			{
				if($records != 1)
				echo date("d-M-Y", strtotime($emp_joblvl['emp_joblvl_start'])).'<br />';
			echo $emp_joblvl['joblvl']['joblvl_desc'].': ';	echo date("d-M-Y", strtotime($emp_joblvl['emp_joblvl_start'])).' - present.<br />';
			}
			else if ($records == 1)
			{
			echo $emp_joblvl['joblvl']['joblvl_desc'].': ';
			echo date("d-M-Y", strtotime($emp_joblvl['emp_joblvl_start'])).' - ';
			}
			else		
			{
			echo date("d-M-Y", strtotime($emp_joblvl['emp_joblvl_start']));
			echo '<br />';
			echo $emp_joblvl['joblvl']['joblvl_desc'].': ';
			echo date("d-M-Y", strtotime($emp_joblvl['emp_joblvl_start'])).' - ';
			
			}
			?>
			<?php 
			$records++;
			endforeach; 
			//---------------------------------
			?>
		</td>
		<td>
			<?php
			//Loop to Display Dates of Job Type (Historical)
			$records = 1;
			$loops = count($employee['EmployeeJobType']);
			foreach ($employee['EmployeeJobType'] as $emp_joblvl): ?>
			<?php
			if($records >= $loops)
			{
				if($records != 1)
				echo date("d-M-Y", strtotime($emp_joblvl['emp_jobtype_start'])).'<br />';
			echo $emp_joblvl['jobtype']['jobtype_desc'].': ';	echo date("d-M-Y", strtotime($emp_joblvl['emp_jobtype_start'])).' - present.<br />';
			}
			else if ($records == 1)
			{
			echo $emp_joblvl['jobtype']['jobtype_desc'].': ';
			echo date("d-M-Y", strtotime($emp_joblvl['emp_jobtype_start'])).' - ';
			}
			else		
			{
			echo date("d-M-Y", strtotime($emp_joblvl['emp_jobtype_start']));
			echo '<br />';
			echo $emp_joblvl['jobtype']['jobtype_desc'].': ';
			echo date("d-M-Y", strtotime($emp_joblvl['emp_jobtype_start'])).' - ';
			
			}
			?>
			<?php 
			$records++;
			endforeach; 
			//---------------------------------
			?>
		
			
		</td>
		<td>
			<?php
			//Loop to Display Dates of Job Status (Historical)
			$records = 1;
			$loops = count($employee['EmployeeJobStatus']);
			foreach ($employee['EmployeeJobStatus'] as $emp_joblvl): ?>
			<?php
			if($records >= $loops)
			{
				if($records != 1)
				echo date("d-M-Y", strtotime($emp_joblvl['emp_jobstatus_start'])).'<br />';
			echo $emp_joblvl['jobstatus']['jobstatus_desc'].': ';	echo date("d-M-Y", strtotime($emp_joblvl['emp_jobstatus_start'])).' - present.<br />';
			}
			else if ($records == 1)
			{
			echo $emp_joblvl['jobstatus']['jobstatus_desc'].': ';
			echo date("d-M-Y", strtotime($emp_joblvl['emp_jobstatus_start'])).' - ';
			}
			else		
			{
			echo date("d-M-Y", strtotime($emp_joblvl['emp_jobstatus_start']));
			echo '<br />';
			echo $emp_joblvl['jobstatus']['jobstatus_desc'].': ';
			echo date("d-M-Y", strtotime($emp_joblvl['emp_jobstatus_start'])).' - ';
			
			}
			?>
			<?php 
			$records++;
			endforeach; 
			//---------------------------------
			?>
		
			
		</td>
			
	</tr>
</table>
</div>
